package com.seo.textgen.pos;

import com.seo.textgen.charclassifier.CharClassifier;

public class RemoveOtherCharsTextPreprocessor {

	private CharClassifier charClassifier;

	public RemoveOtherCharsTextPreprocessor(CharClassifier charClassifier) {
		this.charClassifier = charClassifier;
	}

	public String preprocessText(String text) {
		char[] chars = new char[text.length()];
		int p = 0;
		for (int i = 0; i < text.length(); i++) {
			if (!charClassifier.isOther(text.charAt(i))) {
				chars[p++] = text.charAt(i);
			}
		}
		return new String(chars, 0, p);
	}

}
